home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / math / ast53src.zip / INTRPRET.C < prev    next >
C/C++ Source or Header  |  1996-09-29  |  23KB  |  675 lines

  1. /*
  2. ** Astrolog (Version 5.30) File: intrpret.c
  3. **
  4. ** IMPORTANT NOTICE: The graphics database and chart display routines
  5. ** used in this program are Copyright (C) 1991-1996 by Walter D. Pullen
  6. ** (Astara@msn.com, http://www.magitech.com/~cruiser1/astrolog.htm).
  7. ** Permission is granted to freely use and distribute these routines
  8. ** provided one doesn't sell, restrict, or profit from them in any way.
  9. ** Modification is allowed provided these notices remain with any
  10. ** altered or edited versions of the program.
  11. **
  12. ** The main planetary calculation routines used in this program have
  13. ** been Copyrighted and the core of this program is basically a
  14. ** conversion to C of the routines created by James Neely as listed in
  15. ** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  16. ** available from Matrix Software. The copyright gives us permission to
  17. ** use the routines for personal use but not to sell them or profit from
  18. ** them in any way.
  19. **
  20. ** The PostScript code within the core graphics routines are programmed
  21. ** and Copyright (C) 1992-1993 by Brian D. Willoughby
  22. ** (brianw@sounds.wa.com). Conditions are identical to those above.
  23. **
  24. ** The extended accurate ephemeris databases and formulas are from the
  25. ** calculation routines in the program "Placalc" and are programmed and
  26. ** Copyright (C) 1989,1991,1993 by Astrodienst AG and Alois Treindl
  27. ** (alois@azur.ch). The use of that source code is subject to
  28. ** regulations made by Astrodienst Zurich, and the code is not in the
  29. ** public domain. This copyright notice must not be changed or removed
  30. ** by any user of this program.
  31. **
  32. ** Initial programming 8/28,30, 9/10,13,16,20,23, 10/3,6,7, 11/7,10,21/1991.
  33. ** X Window graphics initially programmed 10/23-29/1991.
  34. ** PostScript graphics initially programmed 11/29-30/1992.
  35. ** Last code change made 9/22/1996.
  36. */
  37.  
  38. #include "astrolog.h"
  39.  
  40.  
  41. #ifdef INTERPRET
  42. /*
  43. ******************************************************************************
  44. ** Interpretation Routines.
  45. ******************************************************************************
  46. */
  47.  
  48. /* This function is used by the interpretation routines to print out lines  */
  49. /* of text with newlines inserted just before the end of screen is reached. */
  50.  
  51. void FieldWord(sz)
  52. char *sz;
  53. {
  54.   static char line[cchSzMax];
  55.   static int cursor = 0;
  56.   int i, j;
  57.  
  58.   /* Hack: Dump buffer if function called with a null string. */
  59.  
  60.   if (sz == NULL) {
  61.     line[cursor] = 0;
  62.     PrintSz(line); PrintL();
  63.     cursor = 0;
  64.     return;
  65.   }
  66.   if (cursor)
  67.     line[cursor++] = ' ';
  68.   for (i = 0; (line[cursor] = sz[i]); i++, cursor++)
  69.     ;
  70.  
  71.   /* When buffer overflows 'n' columns, display one line and start over. */
  72.  
  73.   while (cursor >= us.nScreenWidth-1) {
  74.     for (i = us.nScreenWidth-1; line[i] != ' '; i--)
  75.       ;
  76.     line[i] = 0;
  77.     PrintSz(line); PrintL();
  78.     line[0] = line[1] = ' ';
  79.     for (j = 2; (line[j] = line[i+j-1]) != 0; j++)
  80.       ;
  81.     cursor -= (i-1);
  82.   }
  83. }
  84.  
  85.  
  86. /* Display a general interpretation of what each sign of the zodiac, house, */
  87. /* and planet or object means. This is called to do the -I0 switch table.   */
  88.  
  89. void InterpretGeneral()
  90. {
  91.   char sz[cchSzDef*2];
  92.   int i;
  93.  
  94.   PrintSz("Signs of the zodiac represent psychological characteristics.\n\n");
  95.   for (i = 1; i <= cSign; i++) {
  96.     AnsiColor(kSignA(i));
  97.     sprintf(sz, "%s is", szSignName[i]); FieldWord(sz);
  98.     sprintf(sz, "%s, and", szDesc[i]); FieldWord(sz);
  99.     sprintf(sz, "%s.", szDesire[i]); FieldWord(sz);
  100.     FieldWord(NULL);
  101.   }
  102.   AnsiColor(kDefault);
  103.   PrintSz("\nHouses represent different areas within one's life.\n\n");
  104.   for (i = 1; i <= cSign; i++) {
  105.     AnsiColor(kSignA(i));
  106.     sprintf(sz, "The %d%s House is the area of life dealing with",
  107.       i, szSuffix[i]); FieldWord(sz);
  108.     sprintf(sz, "%s.", szLifeArea[i]); FieldWord(sz);
  109.     FieldWord(NULL);
  110.   }
  111.   AnsiColor(kDefault);
  112.   PrintSz("\nPlanets represent various parts of one's mind or self.\n\n");
  113.   for (i = 1; i <= cObjInt; i++) {
  114.     if (ignore[i] || FCusp(i))
  115.       continue;
  116.     AnsiColor(kObjA[i]);
  117.     if (i <= oMoo || (FBetween(i, oNod, oCore)) && (i != oLil || fSouthNode))
  118.       FieldWord("The");
  119.     sprintf(sz, "%s%s%s represents one's",
  120.       i == oNod ? "North " : (i == oFor ? "Part of " : ""), szObjName[i],
  121.       i == 13 ? " Athena" : ""); FieldWord(sz);
  122.     sprintf(sz, "%s.", szMindPart[i]); FieldWord(sz);
  123.     FieldWord(NULL);
  124.   }
  125.   AnsiColor(kDefault);
  126. }
  127.  
  128.  
  129. /* Display a general interpretation of what each aspect type means. This */
  130. /* is called when printing the interpretation table in the -I0 switch.   */
  131.  
  132. void InterpretAspectGeneral()
  133. {
  134.   char sz[cchSzDef*2];
  135.   int i;
  136.  
  137.   PrintSz("\nAspects are different relationships between planets.\n\n");
  138.   for (i = 1; i <= Min(us.nAsp, cAspectInt); i++) {
  139.     AnsiColor(kAspA[i]);
  140.     sprintf(sz, "When planets are %s, one", szAspectName[i]);
  141.     FieldWord(sz); sprintf(sz, szInteract[i], ""); FieldWord(sz);
  142.     FieldWord("another.");
  143.     if (szTherefore[i][0]) {
  144.       sprintf(sz, "%s.", szTherefore[i]); FieldWord(sz);
  145.     }
  146.     FieldWord(NULL);
  147.   }
  148.   return;
  149. }
  150.  
  151.  
  152. /* Print the interpretation of each planet in sign and house, as specified */
  153. /* with the -I switch. This is basically array accessing combining the     */
  154. /* meanings of each planet, sign, and house, and a couple of other things. */
  155.  
  156. void InterpretLocation()
  157. {
  158.   char sz[cchSzDef*2], c;
  159.   int i, j;
  160.  
  161.   PrintL();
  162.   for (i = 1; i <= cObjInt; i++) {
  163.     if (ignore[i] || FCusp(i))
  164.       continue;
  165.     AnsiColor(kObjA[i]);
  166.     j = SFromZ(planet[i]); c = Dignify(i, j);
  167.     sprintf(sz, "%s%s%s%s in %s", ret[i] < 0.0 ? "Retrograde " : "",
  168.       i == oNod ? "North " : (i == oFor ? "Part of " : ""), szObjName[i],
  169.       i == 13 ? " Athena" : "", szSignName[j]);
  170.     FieldWord(sz);
  171.     sprintf(sz, "and %d%s House:", inhouse[i], szSuffix[inhouse[i]]);
  172.     FieldWord(sz);
  173.     sprintf(sz, "%s's", szPerson); FieldWord(sz);
  174.     FieldWord(szMindPart[i]); FieldWord("is");
  175.     if (((int)planet[i]) % 30 < 10)
  176.       FieldWord("very");
  177.     sprintf(sz, "%s, and", szDesc[j]); FieldWord(sz);
  178.     sprintf(sz, "%s.", szDesire[j]); FieldWord(sz);
  179.     FieldWord("Most often this manifests");
  180.     if (ret[i] < 0.0 && i != oNod)
  181.       FieldWord("in an independent, backward, introverted manner, and");
  182.     FieldWord("in the area of life dealing with");
  183.     sprintf(sz, "%s.", szLifeArea[inhouse[i]]); FieldWord(sz);
  184.  
  185.     /* Extra information if planet is in its ruling, falling, etc, sign. */
  186.  
  187.     if (c == 'R')
  188.       FieldWord("This is a major aspect of their psyche!");
  189.     else if (c == 'F')
  190.       FieldWord("(This bit plays only a minor part in their psyche.)");
  191.     else if (c == 'e')
  192.       FieldWord("It is easy for them to express this part of themself.");
  193.     else if (c == 'd')
  194.       FieldWord("It is difficult for them to express this part of themself.");
  195.     FieldWord(NULL);
  196.   }
  197. }
  198.  
  199.  
  200. /* Print an interpretation for a particular aspect in effect in a chart. */
  201. /* This is called from the InterpretGrid and ChartAspect routines.       */
  202.  
  203. void InterpretAspect(x, y)
  204. int x, y;
  205. {
  206.   char sz[cchSzDef*2];
  207.   int n;
  208.  
  209.   n = grid->n[x][y];
  210.   if (n < 1 || n > cAspectInt ||
  211.     FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  212.     return;
  213.   AnsiColor(kAspA[n]);
  214.   sprintf(sz, "%s %s %s: %s's", szObjName[x],
  215.     szAspectName[n], szObjName[y], szPerson);
  216.   FieldWord(sz); FieldWord(szMindPart[x]);
  217.   sprintf(sz, szInteract[n],
  218.     szModify[Min(abs(grid->v[x][y])/150, 2)][n-1]);
  219.   FieldWord(sz);
  220.   sprintf(sz, "their %s.", szMindPart[y]); FieldWord(sz);
  221.   if (szTherefore[n][0]) {
  222.     sprintf(sz, "%s.", szTherefore[n]); FieldWord(sz);
  223.   }
  224.   FieldWord(NULL);
  225. }
  226.  
  227.  
  228. /* Print the interpretation of each aspect in the aspect grid, as specified */
  229. /* with the -g -I switch. Again, this is done by basically array accessing  */
  230. /* of the meanings of the two planets in aspect and of the aspect itself.   */
  231.  
  232. void InterpretGrid()
  233. {
  234.   int i, j;
  235.  
  236.   for (i = 1; i < cObjInt; i++) if (!ignore[i] && !FCusp(i))
  237.     for (j = i+1; j <= cObjInt; j++) if (!ignore[j] && !FCusp(i))
  238.       InterpretAspect(i, j);
  239. }
  240.  
  241.  
  242. /* Print an interpretation for a particular midpoint in effect in a chart. */
  243. /* This is called from the ChartMidpoint routine.                          */
  244.  
  245. void InterpretMidpoint(x, y)
  246. int x, y;
  247. {
  248.   char sz[cchSzDef*2];
  249.   int n, i;
  250.  
  251.   if (FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  252.     return;
  253.   n = grid->n[y][x];
  254.   AnsiColor(kSignA(n));
  255.   sprintf(sz, "%s midpoint %s in %s: The merging of %s's",
  256.     szObjName[x], szObjName[y], szSignName[n], szPerson0);
  257.   FieldWord(sz); FieldWord(szMindPart[x]);
  258.   FieldWord("with their"); FieldWord(szMindPart[y]);
  259.   FieldWord("is");
  260.   if (grid->v[y][x]/60 < 10)
  261.     FieldWord("very");
  262.   sprintf(sz, "%s, and", szDesc[n]); FieldWord(sz);
  263.   sprintf(sz, "%s.", szDesire[n]); FieldWord(sz);
  264.   FieldWord("Most often this manifests in");
  265.   if (ret[x]+ret[y] < 0.0 && x != oNod && y != oNod)
  266.     FieldWord("an independent, backward, introverted manner, and");
  267.   FieldWord("the area of life dealing with");
  268.   i = HousePlaceIn(ZFromS(n) + (real)grid->v[y][x]/60.0);
  269.   sprintf(sz, "%s.", szLifeArea[i]); FieldWord(sz);
  270.   FieldWord(NULL);
  271. }
  272.  
  273.  
  274. /* This is a subprocedure of ChartInDaySearch(). Print the interpretation    */
  275. /* for a particular instance of the various exciting events that can happen. */
  276.  
  277. void InterpretInDay(source, aspect, dest)
  278. int source, aspect, dest;
  279. {
  280.   char sz[cchSzDef*2];
  281.  
  282.   if (source > cObjInt || dest > cObjInt)
  283.     return;
  284.  
  285.   /* Interpret object changing direction. */
  286.  
  287.   if (aspect == aDir) {
  288.     AnsiColor(kObjA[source]);
  289.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  290.     FieldWord("will tend to manifest in");
  291.     FieldWord(dest ? "an independent, backward, introverted" :
  292.       "the standard, direct, open");
  293.     FieldWord("manner.");
  294.     FieldWord(NULL);
  295.  
  296.   /* Interpret object entering new sign. */
  297.  
  298.   } else if (aspect == aSig) {
  299.     AnsiColor(kObjA[source]);
  300.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  301.     sprintf(sz, "will be %s,", szDesc[dest]);
  302.     FieldWord(sz);
  303.     sprintf(sz, "and it %s.", szDesire[dest]); FieldWord(sz);
  304.     FieldWord(NULL);
  305.  
  306.   /* Interpret aspect between transiting planets. */
  307.  
  308.   } else if (aspect > 0 && aspect <= cAspectInt) {
  309.     AnsiColor(kAspA[aspect]);
  310.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  311.     sprintf(sz, szInteract[aspect], szModify[1][aspect-1]);
  312.     FieldWord(sz);
  313.     sprintf(sz, "energies of %s.", szMindPart[dest]); FieldWord(sz);
  314.     if (szTherefore[aspect][0]) {
  315.       if (aspect > aCon) {
  316.         sprintf(sz, "%s.", szTherefore[aspect]); FieldWord(sz);
  317.       } else
  318.         FieldWord("They will affect each other prominently.");
  319.     }
  320.     FieldWord(NULL);
  321.   }
  322. }
  323.  
  324.  
  325. /* This is a subprocedure of ChartTransitSearch(). Print the interpretation */
  326. /* for a particular transit of a planet to a natal object of a chart.       */
  327.  
  328. void InterpretTransit(source, aspect, dest)
  329. int source, aspect, dest;
  330. {
  331.   char sz[cchSzDef*2];
  332.  
  333.   if (source <= oCore && dest <= oCore && aspect <= cAspectInt) {
  334.     AnsiColor(kAspA[aspect]);
  335.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  336.     sprintf(sz, szInteract[aspect], szModify[1][aspect-1]);
  337.     FieldWord(sz);
  338.     if (source != dest) {
  339.       sprintf(sz, "%s's %s.", szPerson0, szMindPart[dest]);
  340.     } else {
  341.       sprintf(sz, "the same aspect inside %s's makeup.", szPerson0);
  342.     }
  343.     FieldWord(sz);
  344.     if (szTherefore[aspect][0]) {
  345.       if (aspect > aCon) {
  346.         sprintf(sz, "%s.", szTherefore[aspect]); FieldWord(sz);
  347.       } else
  348.         FieldWord("This part of their psyche will be strongly influenced.");
  349.     }
  350.     FieldWord(NULL);
  351.   }
  352. }
  353.  
  354.  
  355. /* Print the interpretation of one person's planet in another's sign and    */
  356. /* house, in a synastry chart as specified with the -r switch combined with */
  357. /* -I. This is very similar to the interpretation of the standard -v chart  */
  358. /* in InterpretLocation(), but we treat the chart as a relationship here.   */
  359.  
  360. void InterpretSynastry()
  361. {
  362.   char sz[cchSzDef*2], c;
  363.   int i, j;
  364.  
  365.   PrintL();
  366.   for (i = 1; i <= cObjInt; i++) {
  367.     if (ignore[i] || FCusp(i))
  368.       continue;
  369.     AnsiColor(kObjA[i]);
  370.     j = SFromZ(planet[i]); c = Dignify(i, j);
  371.     sprintf(sz, "%s%s%s%s in %s,", ret[i] < 0.0 ? "Retrograde " : "",
  372.       i == oNod ? "North " : (i == oFor ? "Part of " : ""), szObjName[i],
  373.       i == 13 ? " Athena" : "", szSignName[j]);
  374.     FieldWord(sz);
  375.     sprintf(sz, "in their %d%s House:", inhouse[i], szSuffix[inhouse[i]]);
  376.     FieldWord(sz);
  377.     sprintf(sz, "%s's", szPerson2); FieldWord(sz);
  378.     FieldWord(szMindPart[i]); FieldWord("is");
  379.     if (((int)planet[i]) % 30 < 10)
  380.       FieldWord("very");
  381.     sprintf(sz, "%s, and", szDesc[j]); FieldWord(sz);
  382.     sprintf(sz, "%s.", szDesire[j]); FieldWord(sz);
  383.     FieldWord("This");
  384.     if (ret[i] < 0.0 && i != oNod)
  385.       FieldWord(
  386.         "manifests in an independent, backward, introverted manner, and");
  387.     sprintf(sz, "affects %s in the area of life dealing with %s.",
  388.       szPerson1, szLifeArea[inhouse[i]]); FieldWord(sz);
  389.  
  390.     /* Extra information if planet is in its ruling, falling, etc, sign. */
  391.  
  392.     if (c == 'R') {
  393.       sprintf(sz, "This is a major aspect of %s's psyche!", szPerson2);
  394.       FieldWord(sz);
  395.     } else if (c == 'F') {
  396.       sprintf(sz, "(This bit plays only a minor part in %s's psyche.)",
  397.         szPerson2);
  398.       FieldWord(sz);
  399.     } else if (c == 'e') {
  400.       sprintf(sz, "%s is affected harmoniously in this way.", szPerson1);
  401.       FieldWord(sz);
  402.     } else if (c == 'd') {
  403.       sprintf(sz, "%s is affected discordantly in this way.", szPerson1);
  404.       FieldWord(sz);
  405.     }
  406.     FieldWord(NULL);
  407.   }
  408. }
  409.  
  410.  
  411. /* Print an interpretation for a particular aspect in effect in a comparison */
  412. /* relationship chart. This is called from the InterpretGridRelation and     */
  413. /* the ChartAspectRelation routines.                                         */
  414.  
  415. void InterpretAspectRelation(x, y)
  416. int x, y;
  417. {
  418.   char sz[cchSzDef*2];
  419.   int n;
  420.  
  421.   n = grid->n[y][x];
  422.   if (n < 1 || n > cAspectInt ||
  423.     FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  424.     return;
  425.   AnsiColor(kAspA[n]);
  426.   sprintf(sz, "%s %s %s: %s's", szObjName[x],
  427.     szAspectName[n], szObjName[y], szPerson1);
  428.   FieldWord(sz); FieldWord(szMindPart[x]);
  429.   sprintf(sz, szInteract[n],
  430.     szModify[Min(abs(grid->v[y][x])/150, 2)][n-1]);
  431.   FieldWord(sz);
  432.   sprintf(sz, "%s's %s.", szPerson2, szMindPart[y]); FieldWord(sz);
  433.   if (szTherefore[n][0]) {
  434.     if (n != 1) {
  435.       sprintf(sz, "%s.", szTherefore[n]); FieldWord(sz);
  436.     } else
  437.       FieldWord("These parts affect each other prominently.");
  438.   }
  439.   FieldWord(NULL);
  440. }
  441.  
  442.  
  443. /* Print the interpretation of each aspect in the relationship aspect grid, */
  444. /* as specified with the -r0 -g -I switch combination.                      */
  445.  
  446. void InterpretGridRelation()
  447. {
  448.   int i, j;
  449.  
  450.   for (i = 1; i <= cObjInt; i++) if (!ignore[i])
  451.     for (j = 1; j <= cObjInt; j++) if (!ignore[j])
  452.       InterpretAspectRelation(i, j);
  453. }
  454.  
  455.  
  456. /* Print the interpretation of a midpoint in the relationship grid, as */
  457. /* specified with the -r0 -m -I switch combination.                    */
  458.  
  459. void InterpretMidpointRelation(x, y)
  460. int x, y;
  461. {
  462.   char sz[cchSzDef*2];
  463.   int n;
  464.  
  465.   if (FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  466.     return;
  467.   n = grid->n[y][x];
  468.   AnsiColor(kSignA(n));
  469.   sprintf(sz, "%s midpoint %s in %s: The merging of %s's",
  470.     szObjName[x], szObjName[y], szSignName[n], szPerson1);
  471.   FieldWord(sz); FieldWord(szMindPart[x]);
  472.   sprintf(sz, "with %s's", szPerson2); FieldWord(sz);
  473.   FieldWord(szMindPart[y]); FieldWord("is");
  474.   if (grid->v[y][x]/60 < 10)
  475.     FieldWord("very");
  476.   sprintf(sz, "%s, and", szDesc[n]); FieldWord(sz);
  477.   sprintf(sz, "%s.", szDesire[n]); FieldWord(sz);
  478.   if (cp1.dir[x]+cp2.dir[y] < 0.0 && x != oNod && y != oNod) {
  479.     FieldWord("Most often this manifests in");
  480.     FieldWord("an independent, backward, introverted manner.");
  481.   }
  482.   FieldWord(NULL);
  483. }
  484. #endif /* INTERPRET */
  485.  
  486.  
  487. /*
  488. ******************************************************************************
  489. ** Chart Influence Routines.
  490. ******************************************************************************
  491. */
  492.  
  493. /* This is a subprocedure of ChartInfluence(). Based on the values in the */
  494. /* array parameter 'value', store numbers in array 'rank' reflecting the  */
  495. /* relative order, e.g. value[x] 2nd greatest array value -> rank[x] = 2. */
  496.  
  497. void SortRank(value, rank, size)
  498. real *value;
  499. int *rank, size;
  500. {
  501.   int h, i, j, k;
  502.  
  503.   value[0] = -1.0;
  504.   for (i = 1; i <= size; i++)
  505.     rank[i] = -1;
  506.   for (h = 1, i = 0; h <= size; h++) {
  507.     if (size != cSign && (ignore[h] || !FThing(h)))
  508.       continue;
  509.     i++;
  510.     k = 0;
  511.     for (j = 1; j <= size; j++) {
  512.       if (size != cSign && (ignore[j] || !FThing(j)))
  513.         continue;
  514.       if (value[j] > value[k] && rank[j] < 0)
  515.         k = j;
  516.     }
  517.  
  518.     /* 'k' is the current position of the 'i'th place planet. */
  519.  
  520.     rank[k] = i;
  521.   }
  522. }
  523.  
  524.  
  525. /* Print out a list of power values and relative rankings, based on the */
  526. /* placements of the planets, and their aspects in the aspect grid, as  */
  527. /* specified with the -j "find influences" switch.                      */
  528.  
  529. void ChartInfluence()
  530. {
  531.   real power[oNorm+1], power1[oNorm+1], power2[oNorm+1],
  532.     total, total1, total2, x;
  533.   int rank[oNorm+1], rank1[oNorm+1], rank2[oNorm+1], i, j, k, l;
  534.   char sz[cchSzDef], c;
  535.  
  536.   for (i = 1; i <= oNorm; i++)
  537.     power1[i] = power2[i] = 0.0;
  538.   total = total1 = total2 = 0.0;
  539.  
  540.   /* First, for each object, find its power based on its placement alone. */
  541.  
  542.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  543.     j = SFromZ(planet[i]);
  544.     power1[i] += rObjInf[i];               /* Influence of planet itself. */
  545.     power1[i] += rHouseInf[inhouse[i]];    /* Influence of house it's in. */
  546.     c = Dignify(i, j);
  547.     switch (c) {
  548.     case 'R': x = rObjInf[oNorm+1]; break; /* Planets in signs they rule / */
  549.     case 'e': x = rObjInf[oNorm+2]; break; /* exalted in have influence.   */
  550.     default:  x = 0.0;
  551.     }
  552.     c = Dignify(i, inhouse[i]);
  553.     switch (c) {
  554.     case 'R': x += rHouseInf[cSign+1]; break; /* Item in house aligned with */
  555.     case 'e': x += rHouseInf[cSign+2]; break; /* sign ruled has influence.  */
  556.     default: ;
  557.     }
  558.     power1[i] += x;
  559.     if (i != rules[j])                       /* The planet ruling the sign */
  560.       power1[rules[j]] += rObjInf[i]/2.0;    /* and the house that the     */
  561.     if (i != (j = rules[inhouse[i]]))        /* current planet is in, gets */
  562.       power1[j] += rObjInf[i]/2.0;           /* extra influence.           */
  563.   }
  564.   for (i = 1; i <= cSign; i++) {         /* Various planets get influence */
  565.     j = SFromZ(chouse[i]);               /* if house cusps fall in signs  */
  566.     power1[rules[j]] += rHouseInf[i];    /* they rule.                    */
  567.   }
  568.  
  569.   /* Second, for each object, find its power based on aspects it makes. */
  570.  
  571.   if (!FCreateGrid(fFalse))
  572.     return;
  573.   for (j = 1; j <= oNorm; j++) if (!ignore[j] && FThing(j))
  574.     for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i) && i != j) {
  575.       k = grid->n[Min(i, j)][Max(i, j)];
  576.       if (k) {
  577.         l = grid->v[Min(i, j)][Max(i, j)];
  578.         power2[j] += rAspInf[k]*rObjInf[i]*
  579.           (1.0-RAbs((real)l)/60.0/GetOrb(i, j, k));
  580.       }
  581.     }
  582.  
  583.   /* Calculate total power of each planet. */
  584.  
  585.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  586.     power[i] = power1[i]+power2[i]; total1 += power1[i]; total2 += power2[i];
  587.   }
  588.   total = total1+total2;
  589.  
  590.   /* Finally, determine ranks of the arrays, then print everything out. */
  591.  
  592.   SortRank(power1, rank1, oNorm); SortRank(power2, rank2, oNorm);
  593.   SortRank(power, rank, oNorm);
  594.   PrintSz("  Planet:    Position      Aspects    Total Rank  Percent\n");
  595.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  596.     AnsiColor(kObjA[i]);
  597.     sprintf(sz, "%8.8s: ", szObjName[i]); PrintSz(sz);
  598.     sprintf(sz, "%6.1f (%2d) +%6.1f (%2d) =%7.1f (%2d) /%6.1f%%\n",
  599.       power1[i], rank1[i], power2[i], rank2[i], power[i], rank[i],
  600.       total > 0.0 ? power[i]/total*100.0 : 0.0); PrintSz(sz);
  601.   }
  602.   AnsiColor(kDefault);
  603.   sprintf(sz, "   Total: %6.1f      +%6.1f      =%7.1f      / 100.0%%\n",
  604.     total1, total2, total); PrintSz(sz);
  605.  
  606.   /* Now, print out a list of power values and relative rankings, based on  */
  607.   /* the power of each sign of the zodiac, as indicated by the placement of */
  608.   /* the planets above, in the chart, as specified with the -j0 switch.     */
  609.  
  610.   if (!us.fInfluenceSign)
  611.     return;
  612.   for (i = 1; i <= cSign; i++)
  613.     power1[i] = 0.0;
  614.  
  615.   /* For each sign, determine its power based on the power of the object. */
  616.  
  617.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  618.     power1[SFromZ(planet[i])] += power[i] / 2.0;
  619.     power1[inhouse[i]]        += power[i] / 4.0;
  620.     power1[ruler1[i]]         += power[i] / 3.0;
  621.     if (ruler2[i])
  622.       power1[ruler2[i]]       += power[i] / 4.0;
  623.   }
  624.   if (!fSouthNode && !ignore[oNod]) {
  625.     power1[Mod12(SFromZ(planet[oNod])+6)] += power[oNod] / 2.0;  /* South */
  626.     power1[Mod12(inhouse[oNod]+6)]        += power[oNod] / 4.0;  /* Node. */
  627.   }
  628.   for (i = cThing+1; i <= oCore; i++) if (!ignore[i]) {
  629.     power1[SFromZ(planet[i])] += rObjInf[i];
  630.   }
  631.  
  632.   total1 = 0.0;
  633.   for (i = 1; i <= cSign; i++)
  634.     total1 += power1[i];
  635.   for (i = 1; i <= cSign; i++) if (total1 > 0.0)
  636.     power1[i] *= total/total1;
  637.   total1 = total;
  638.  
  639.   /* Again, determine ranks in the array, and print everything out. */
  640.  
  641.   SortRank(power1, rank1, cSign);
  642.   PrintSz(
  643.     "\n       Sign:  Power Rank  Percent  -   Element  Power  Percent\n");
  644.   for (i = 1; i <= cSign; i++) {
  645.     AnsiColor(kSignA(i));
  646.     sprintf(sz, "%11.11s: ", szSignName[i]); PrintSz(sz);
  647.     sprintf(sz, "%6.1f (%2d) /%6.1f%%", power1[i],
  648.       rank1[i], total1 > 0.0 ? power1[i]/total1*100.0 : 0.0); PrintSz(sz);
  649.     if (i <= 4) {
  650.       sprintf(sz, "  -%9.7s:", szElem[i-1]); PrintSz(sz);
  651.       total2 = 0.0;
  652.       for (j = 1; j < cSign; j += 4)
  653.         total2 += power1[i-1+j];
  654.       sprintf(sz, "%7.1f /%6.1f%%", total2,
  655.         total1 > 0.0 ? total2/total1*100.0 : 0.0); PrintSz(sz);
  656.     } else if (i == 6) {
  657.       AnsiColor(kDefault);
  658.       PrintSz("  -      Mode  Power  Percent");
  659.     } else if (i >= 7 && i <= 9) {
  660.       AnsiColor(kModeA(i-7));
  661.       sprintf(sz, "  -%9.8s:", szMode[i-7]); PrintSz(sz);
  662.       total2 = 0.0;
  663.       for (j = 1; j < cSign; j += 3)
  664.         total2 += power1[i-7+j];
  665.       sprintf(sz, "%7.1f /%6.1f%%", total2,
  666.         total1 > 0.0 ? total2/total1*100.0 : 0.0); PrintSz(sz);
  667.     }
  668.     PrintL();
  669.   }
  670.   AnsiColor(kDefault);
  671.   sprintf(sz, "      Total:%7.1f      / 100.0%%\n", total1); PrintSz(sz);
  672. }
  673.  
  674. /* intrpret.c */
  675.